public class GirFriendTest {
    public static void main(String[] args) {
        GirFriend g1 = new GirFriend("02", 20, '女', "kiss");
        GirFriend g2 = new GirFriend("小鸟游六花", 31, '女', "变身");
        GirFriend g3 = new GirFriend("小鸟游十花", 28, '女', "结婚");
        GirFriend g4 = new GirFriend("蝴蝶忍", 24, '女', "杀鬼");
        GirFriend[] arr = new GirFriend[4];
        arr[0] = g1;
        arr[1] = g2;
        arr[2] = g3;
        arr[3] = g4;
        int AverAge = age(g1.getAge(), g2.getAge(), g3.getAge(), g4.getAge());
        System.out.println("平均年龄为:" + AverAge);
        int number = count(g1.getAge(), g2.getAge(), g3.getAge(), g4.getAge(), AverAge);
        System.out.println("低于平均年龄的有"+number);

    }

    public static int age(int age1, int age2, int age3, int age4) {
        int AverAge = (age1 + age2 + age3 + age4) / 4;
        return AverAge;
    }

    public static int count(int age1, int age2, int age3, int age4, int AverAge) {
        int sum = 0;
        int[] arr = {age1, age2, age3, age4};
        for (int i = 0; i < arr.length; i++) {
            if (arr[i] <= AverAge) {
                sum++;
            }


        }

        return sum;
    }


}
